package org.melanesia.beans;

import java.util.Map;

class PropertyAccessor {

    private String propertyName;
    private Setter setter;
    private Getter getter;
    
    PropertyAccessor(String propertyName, Setter setter, Getter getter) {
        this.propertyName = propertyName;
        this.setter = setter;
        this.getter = getter;
    }
    
    Class<?> getPropertyClass() {
        return getter.getReturnType();
    }
    
    void set(Object bean, Object value, Map<String, Class<?>> intermediateBeanClasses) {
        setter.set(bean, value, intermediateBeanClasses);
    }
    
    Object get(Object bean) {
        return getter.get(bean);
    }
    
    String getPropertyName() {
        return propertyName;
    }
}
